package demo;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 张宇田
 * Date: 2024-10-10
 * Time: 23:49
 */
public class Computer {
    public void powerOn(){
        System.out.println("电脑开机....");
    }

    public void powerOff(){
        System.out.println("电脑关机....");
    }
    public void useDevice (IUSB usb){
        usb.openDevice();
        if(usb instanceof Mouse){
            Mouse mouse =(Mouse) usb;
            mouse.click();
        }else if(usb instanceof Keybord){
            Keybord keybord = (Keybord) usb;
            keybord.input();
        }
        usb.closeDevice();
    }
}
